package com.lanju.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lanju.entity.User;
import com.lanju.service.DepositSlipService;
import com.lanju.util.ServletUtil;

@Controller
@RequestMapping("depositslip")
public class DepositSlipController {
	
	@Autowired
	DepositSlipService depositSlipService;
	
	
	@SuppressWarnings("unchecked")
	@RequestMapping("insertDepositSlip")
	@ResponseBody
	public Map<String,Object> insertDepositSlip(HttpServletRequest request,HttpSession session){
		Map<String,Object> param=ServletUtil.getParameterMap(request);
		User user =(User) session.getAttribute("userModel");
		param.put("creator", user.getUserId());
		return depositSlipService.insertDepositSlip(param);
	}
	
	@SuppressWarnings("unchecked")
	@RequestMapping("queryDepositSlip")
	@ResponseBody
	public Map<String,Object> queryDepositSlipList(HttpServletRequest request){
		Map<String,Object> param=ServletUtil.getParameterMap(request);
		return depositSlipService.queryDepositSlip(param);
	}
	@SuppressWarnings("unchecked")
	@RequestMapping("queryDepotSliById")
	@ResponseBody
	public Map<String,Object> queryDepotSliById(HttpServletRequest request){
		Map<String,Object> param=ServletUtil.getParameterMap(request);
		return depositSlipService.queryDepotSliById(param);
	}
	@SuppressWarnings("unchecked")
	@RequestMapping("delDepotSliById")
	@ResponseBody
	public Map<String,Object> delDepotSliById(HttpServletRequest request){
		Map<String,Object> param=ServletUtil.getParameterMap(request);
		return depositSlipService.delDepotSliById(param);
	}
	@SuppressWarnings("unchecked")
	@RequestMapping("updateDepositSlip")
	@ResponseBody
	public Map<String,Object> updateDepositSlip(HttpServletRequest request){
		Map<String,Object> param=ServletUtil.getParameterMap(request);
		return depositSlipService.updateDepositSlip(param);
	}
	

}
